let industryCloudData = JSON.parse(
  JSON.stringify(require('../../../public/restfulData/industryCloud.json'))
)
//将对象中文键转为英文
function toEnKeys(data, keyMap) {
  return data.map((item) => {
    let obj = {}
    for (let prop in item) {
      if (keyMap.hasOwnProperty(prop)) {
        obj[keyMap[prop]] = item[prop]
      }
    }
    return obj
  })
}

function convertLeftTop(data, target) {
  let keyMap = {
    指标: 'name',
    数值: 'value',
    图标: 'icon'
  }
  let chartData = toEnKeys(data, keyMap)
  target.leftTop = chartData
}

function convertIndustryCloudJson(data) {
  convertLeftTop(data['leftTop'], industryCloudData)
  return industryCloudData
}
export default convertIndustryCloudJson
